package com.denlaku.longan.repository;

import com.denlaku.longan.anno.VarOp;
import com.denlaku.longan.dao.CustomApiDao;
import com.denlaku.longan.qo.CustomApiQuery;
import com.denlaku.longan.qo.Query;
import com.denlaku.longan.vo.CustomApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author tianx
 */
@Repository
public class CustomApiRepository {
    @Autowired
    private CustomApiDao customApiDao;

    /**
     * 新增api信息
     * @param customApi api信息
     */
    @VarOp
    public void add(CustomApi customApi) {
        customApiDao.add(customApi);
    }

    /**
     * 更新api
     * @param customApi api信息
     */
    @VarOp
    public void update(CustomApi customApi) {
        customApiDao.update(customApi);
    }

    /**
     * 删除api
     * @param query 查询参数
     */
    public void delete(Query query) {
        customApiDao.delete(query);
    }

    /**
     * 获取api
     * @param query 查询参数
     * @return api信息
     */
    public CustomApi get(Query query) {
        return customApiDao.get(query);
    }

    /**
     * 查询api
     * @param query 查询参数
     * @return api信息
     */
    public List<CustomApi> list(CustomApiQuery query) {
        return customApiDao.list(query);
    }

}
